using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Adge.Models;
using NHibernate.Expression;
using Adge.Common;

namespace Adge.Web.UI.Admin
{
    public partial class linksCenter : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                lnkNewsEdit.NavigateUrl += Utils.COMMA + Request.QueryString;
                InitInfos();
            }
        }

        private void InitInfos()
        {
            Adge.BLL.AdgeArBase<LinksInfo> catlist = new Adge.BLL.AdgeArBase<LinksInfo>();

            #region Bind Catgory

            ICriterion[] criterias = new ICriterion[] { };
            LinksInfo[] entities = catlist.SlicedFindAll(0, 500, new Order[] { }, criterias);
            gvNewsCenter.DataSource = entities;
            gvNewsCenter.DataBind();
            #endregion
        }

        protected void gvNewsCenter_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            gvNewsCenter.PageIndex = e.NewPageIndex;
            InitInfos();
        }

        protected void gvNewsCenter_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            object key = gvNewsCenter.DataKeys[e.RowIndex].Value;
            Adge.BLL.AdgeArBase<LinksInfo> catlist = new Adge.BLL.AdgeArBase<LinksInfo>();
            catlist.Delete(key);
            InitInfos();
        }
    }
}
